/**
 * declare 只能用来定义类型，不能赋值, 我理解它的存在是为了解决引用第3方加的问题
 */
import { MySayHi, haha } from "zyy";

declare let x: number;

x = 123;

console.log(x);

declare let y: number;

y = 123;

console.log(y);

declare function sayHi(name: string): string;

// function sayHi(name: string): string {
//     return name;
// }

sayHi("abc");

const hahaName = haha("zhangsan");

console.log(hahaName);


declare class C {
	// 静态成员
	public static s0(): string;
	private static s1: string;

	// 属性
	public a: number;
	private b: number;

	// 构造函数
	constructor(arg: number);

	// 方法
	m(x: number, y: number): number;

	// 存取器
	get c(): number;
	set c(value: number);

	// 索引签名
	[index: string]: any;
}

new C(123);

declare namespace AnimalLib {
	class Animal {
		constructor(name: string);
		eat(): void;
		sleep(): void;
	}

	type Animals = "Fish" | "Dog";
}

const animal = new AnimalLib.Animal("Dog");

const aniamType: AnimalLib.Animals = "Dog";

console.log(aniamType);

console.log(animal.eat());
console.log(animal.sleep());

// Yuan.getPerson(p);

/// <reference path="./my-node.d.ts"/>

import { MyAnimal } from "zyy";

import { ReadFile } from "my-io";

const say = MySayHi("zhangsan");

const myAa: MyAnimal = {
	name: "zhangsan",
	age: 18,
};

console.log(myAa);

const fileContent = ReadFile("/temp/abc.txt");

console.log(say);

console.log(fileContent);
